#include <bits/stdc++.h>
using namespace std;
const int N = 110, M = 2010;
int n, m, R;
int p[M][N];
double ans[M];
int o[N];
double d[M], trangent[M];
double sqr(double x) { return x * x; }
double dist(int x[], int y[]) {
  double dis = 0;
  for (int i = 0; i < n; ++i) {
    dis += sqr(x[i] - y[i]);
  }
  return sqrt(dis);
}
int main() {
  scanf("%d%d%d", &n, &m, &R);
  for (int i = 0; i < n; ++i) scanf("%d", &o[i]);
  for (int i = 0; i < m; ++i) {
    double dist = 0;
    for (int j = 0; j < n; ++j) {
      scanf("%d", &p[i][j]);
      dist += sqr(p[i][j] - o[j]);
    }
    d[i] = sqrt(dist), trangent[i] = sqrt(dist - sqr(R));
  }
  // 枚举所有点对 p_i, p_j
  for (int i = 0; i < m; ++i)
    for (int j = 0; j < i; ++j) {
      double a = d[i], b = d[j];
      double c = dist(p[i], p[j]);
      double p = (a + b + c) / 2;
      double s = sqrt(p * (p - a) * (p - b) * (p - c));
      double h = s * 2 / c;
      double len = 0;
      if (h >= R || sqr(a) + sqr(c) < sqr(b) || sqr(b) + sqr(c) < sqr(a)) {
        len = c;
      } else {
        double angle1 = acos((sqr(a) + sqr(b) - sqr(c)) / (2 * a * b));
        double angle2 = acos(R / a);
        double angle3 = acos(R / b);
        double arc = R * (angle1 - angle2 - angle3);
        len = trangent[i] + trangent[j] + arc;
      }
      ans[i] += len, ans[j] += len;
    }

  for (int i = 0; i < m; ++i) printf("%.12lf\n", ans[i]);
}
